<?php
// 扑克类
class Poker {
	public $cards = [];
	 // C梅花 club, D方块diamond, H红桃heart, S黑桃spade
	function __construct()
	{
		$this->makeCards();
	}
	// 生成牌组 不包括大小王 14 15 是A和2
	public function makeCards()
	{
		$suit = ['C','D','H','S'];
		for ($i=3; $i <= 15 ; $i++) { 
			foreach ($suit as $v) {
				$this->cards[] = $v . '_' . $i;				
			}
		}
	}
	// 炸金花发牌(玩家数量)
	public function deal($player_count)
	{
		// $rand_keys = array_rand($this->cards,$player_count * 3);
		shuffle($this->cards);
		$rand = array_slice($this->cards, 0,$player_count * 3);
		for($i=0; $i < $player_count ; $i++)  
		{  
		      $res[] = array_slice($rand, $i * 3 ,3);  
		} 
		return $res;
	}
	// 验牌
	public function validate()
	{

	}

}



?>